import os
ChineseNum = ['','一', '二', '三', '四', '五', '六', '七', '八', '九']
with open("D:\\GitbookLibrary\\SUMMARY.md","w",encoding="utf-8") as f:
    f.write("# /\n")
    f.write("* [Introduction/前言](README.md)\n\n")
    count = 1

    while count < 10 :
        f.write("* [Chapter 0"+str(count)+" /第"+ChineseNum[count]+"章 ](0"+str(count)+"/README.md)\n")
        index = 1
        while index < 10 :
            f.write("  * [Section 0"+str(count)+".0"+str(index)+" /](0"+str(count)+" /0"+str(index)+" .md)\n")
            index += 1
        count += 1

    f.write("\n")

    while count < 20 :
        f.write("* [Chapter "+str(count)+" /第十"+ChineseNum[count-10]+"章 ]("+str(count)+"/README.md)\n")
        index = 1
        while index < 10 :
            f.write("  * [Section "+str(count)+".0"+str(index)+" /]("+str(count)+" /0"+str(index)+" .md)\n")
            index += 1
        count += 1
    f.write("\n")

    while count <= 30 :
        f.write("* [Chapter "+str(count)+" /第"+ChineseNum[count//10]+"十"+ChineseNum[count%10]+"章 ]("+str(count)+"/README.md)\n")
        index = 1
        while index < 10 :
            f.write("  * [Section "+str(count)+".0"+str(index)+" /]("+str(count)+" /0"+str(index)+" .md)\n")
            index += 1
        count += 1

    f.write("\n")

    count = 999
    
    index = 10
    while index < 30 :
        f.write("  * [Section "+str(count)+"."+str(index)+" /]("+str(count)+" /"+str(index)+" .md)\n")
        index += 1
    f.close()